import random

FIRST_NAME = "赵钱孙李周吴郑王冯陈褚卫蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚" \
             "谢邹喻柏水窦章云苏潘葛奚范彭郎鲁韦昌马苗凤花方俞任袁柳酆鲍史唐费廉岑薛雷贺倪汤"
LAST_NAME = ["奕铭", "瑞霖", "悦竹", "明哲", "铭威", "天翊", "书玮", "凯瑞", "凯丞",
             "健雄", "涵煦", "耀杰", "品鸿", "子毅", "潇然", "子涵", "越彬", "尚芃",
             "冠智", "钰轩", "智辉", "致远", "俊驰", "雨泽", "砚名", "烨磊", "晟睿",
             "文昊", "修洁", "青杉", "远航", "熙栋", "旭尧", "鸿涛", "伟祺", "荣轩",
             "展鸣", "越泽", "浩宇", "瑾瑜", "皓轩", "擎苍", "擎宇", "志泽", "珺博",
             "子轩", "睿渊", "弘文", "哲瀚", "雨泽", "楷瑞", "梓航", "建辉", "晋鹏", "天磊", "绍辉", "泽洋"]
COURSE = ['chinese', 'maths', 'english', 'physics', 'chemistry']

GENDER = ['男', '女']

CLASS = "初三(4)班"


class StudentInfo:

    def __init__(self, student_number: int=50, start=50, end=100):
        self.student_number = student_number
        self.start = start
        self.end =end
        self.names = []
        #
        self.results01 = []
        self.results04 = []
        #
        self.get_names()

    # 50个名字
    def get_names(self):
        while len(self.names)<self.student_number:
            temp_first_name = FIRST_NAME[random.randint(0,len(FIRST_NAME)-1)]
            temp_last_name = LAST_NAME[random.randint(0,len(LAST_NAME)-1)]
            if (temp_first_name + temp_last_name).strip() not in self.names:
                self.names.append(temp_first_name+temp_last_name)
    # 学号
    def get_sno(self, sno: str):
        if len(sno) == 1:
            sno = "9500" + sno
        elif len(sno) == 2:
            sno = "950" + sno
        return sno
#     成绩
    def get_random_numbers(self):
        temp_result = []
        while len(temp_result) < len(COURSE):
            temp_result.append(random.randint(self.start,self.end))

# 01    student_result = [
#     {'sno': 95001, 'name': '张译丹', 'gender': '男', 'result': [67, 89, 59, 95, 86]},
# ]
    def get_student_result_one(self):
#         {}
        for index , value in enumerate(self.names):
            temp_dict = {}
            temp_dict['s'] = self.get_sno(str(index + 1))
            temp_dict['n'] = value
            temp_dict['g'] = GENDER[random.randint(0,1)]
            temp_dict['r'] = self.get_random_numbers()
            #
            self.results01.append(temp_dict)


    def get_student_result_four(self):
        # 开始循环
        for index, value in enumerate(self.names):
            # 临时定义一个list集合
            temp_list = []
            temp_list.append(self.get_sno(str(index+1)))

            self.results04.append(temp_list)

if __name__ == '__main__':

    obj01 = StudentInfo()
    obj01.get_student_result_four()
    # test = obj01.get_random_numbers()
    print(obj01.results04)
